<?php

namespace Ruixs\AdminApi\Http\Controllers;

use Illuminate\Support\Facades\Auth;

class LoginController extends Controller
{
    public function login()
    {
        if (Auth::attempt(['username' => 'admin', 'password' => 'admin'])) {
            $token = Auth::user()->createToken('adminapi')->accessToken;
            return $this->success(['token' => $token]);
        }
        return $this->error('username or password error');
    }
}